// https://leetcode-cn.com/problems/binary-search/
int search(int* nums, int numsSize, int target){
    int l = 0, r = numsSize;
    while(l+1<r) {
        int mid = (l+r)/2;
        if(nums[mid] > target) r = mid;
        else l = mid;
    }
    if(nums[l]==target) return l;
    return -1;
}
